/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.lcdui.SplashScreen;

/**
 * @author Rapha
 */
public class HelloMIDlet extends MIDlet implements CommandListener {

    private boolean midletPaused = false;
    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Command exitCommand;
    private Command backCommand;
    private Command valorCommand;
    private Command combustivelCommand;
    private Command resultadoCommand;
    private Command backCommand1;
    private Command backCommand2;
    private Command okCommand;
    private Command exitCommand1;
    private Command backCommand3;
    private Command okCommand1;
    private Command exitCommand2;
    private Form veiculo;
    private ChoiceGroup veiculoGroup;
    private Form combustivel;
    private ChoiceGroup combustivelGroup;
    private Form valor;
    private TextField valorText;
    private Form resultado;
    private StringItem ipvaItem;
    private Form form;
    private StringItem stringItem;
    private Image image1;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The HelloMIDlet constructor.
     */
    public HelloMIDlet() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|
    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getForm());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == combustivel) {//GEN-BEGIN:|7-commandAction|1|36-preAction
            if (command == backCommand) {//GEN-END:|7-commandAction|1|36-preAction
                // write pre-action user code here
                switchDisplayable(null, getVeiculo());//GEN-LINE:|7-commandAction|2|36-postAction
                // write post-action user code here
            } else if (command == valorCommand) {//GEN-LINE:|7-commandAction|3|34-preAction
                // write pre-action user code here
                switchDisplayable(null, getValor());//GEN-LINE:|7-commandAction|4|34-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|5|82-preAction
        } else if (displayable == form) {
            if (command == exitCommand2) {//GEN-END:|7-commandAction|5|82-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|6|82-postAction
                // write post-action user code here
            } else if (command == okCommand1) {//GEN-LINE:|7-commandAction|7|80-preAction
                // write pre-action user code here
                switchDisplayable(null, getVeiculo());//GEN-LINE:|7-commandAction|8|80-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|9|49-preAction
        } else if (displayable == resultado) {
            if (command == backCommand2) {//GEN-END:|7-commandAction|9|49-preAction
                // write pre-action user code here
                switchDisplayable(null, getValor());//GEN-LINE:|7-commandAction|10|49-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|11|45-preAction
        } else if (displayable == valor) {
            if (command == backCommand1) {//GEN-END:|7-commandAction|11|45-preAction
                // write pre-action user code here
                switchDisplayable(null, getCombustivel());//GEN-LINE:|7-commandAction|12|45-postAction
                // write post-action user code here
            } else if (command == resultadoCommand) {//GEN-LINE:|7-commandAction|13|43-preAction
                // write pre-action user code here
                switchDisplayable(null, getResultado());//GEN-LINE:|7-commandAction|14|43-postAction
                // write post-action user code here
                int tpVeiculo = veiculoGroup.getSelectedIndex();
                int tpCombustivel = combustivelGroup.getSelectedIndex();
                double aliquota;
                //aliquota de acordo com o tipo do veiculo
                if (tpVeiculo == 0) {
                    aliquota = 0.04;
                } else if ((tpVeiculo == 1) || (tpVeiculo == 2) || (tpVeiculo == 3) || (tpVeiculo == 4) || (tpVeiculo == 5)) {
                    aliquota = 0.02;
                } else {
                    aliquota = 0.015;
                }
                //aliquota de acordo com o tipo do combustivel
                if ((tpCombustivel == 0) || (tpCombustivel == 1) || (tpCombustivel == 2)) {
                    aliquota = 0.04;
                } else {
                    double aliquotaCombustivel = 0.03;
                    //caso a aliquota pelo tipo seja menor que a pelo combustivel, é usada a do combustivel como parametro
                    if (aliquota < aliquotaCombustivel) {
                        aliquota = aliquotaCombustivel;
                    }
                }

                String vl_veiculo = valorText.getString();
                if (vl_veiculo.equals("")) {
                    ipvaItem.setLabel("O valor venal informado é inválido!");
                    ipvaItem.setText("");
                } else {
                    double vl_venal = Double.parseDouble(vl_veiculo);
                    double valorIpva = vl_venal * aliquota;
                    ipvaItem.setLabel("Valor do IPVA:");
                    ipvaItem.setText(Double.toString(valorIpva));
                }

            }//GEN-BEGIN:|7-commandAction|15|75-preAction
        } else if (displayable == veiculo) {
            if (command == backCommand3) {//GEN-END:|7-commandAction|15|75-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|16|75-postAction
                // write post-action user code here
            } else if (command == combustivelCommand) {//GEN-LINE:|7-commandAction|17|38-preAction
                // write pre-action user code here
                switchDisplayable(null, getCombustivel());//GEN-LINE:|7-commandAction|18|38-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|19|7-postCommandAction
        }//GEN-END:|7-commandAction|19|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|20|
    //</editor-fold>//GEN-END:|7-commandAction|20|


    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand ">//GEN-BEGIN:|18-getter|0|18-preInit
    /**
     * Returns an initiliazed instance of exitCommand component.
     * @return the initialized component instance
     */
    public Command getExitCommand() {
        if (exitCommand == null) {//GEN-END:|18-getter|0|18-preInit
            // write pre-init user code here
            exitCommand = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|18-getter|1|18-postInit
            // write post-init user code here
        }//GEN-BEGIN:|18-getter|2|
        return exitCommand;
    }
    //</editor-fold>//GEN-END:|18-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: veiculo ">//GEN-BEGIN:|14-getter|0|14-preInit
    /**
     * Returns an initiliazed instance of veiculo component.
     * @return the initialized component instance
     */
    public Form getVeiculo() {
        if (veiculo == null) {//GEN-END:|14-getter|0|14-preInit
            // write pre-init user code here
            veiculo = new Form("Calcular IPVA", new Item[] { getVeiculoGroup() });//GEN-BEGIN:|14-getter|1|14-postInit
            veiculo.addCommand(getCombustivelCommand());
            veiculo.addCommand(getBackCommand3());
            veiculo.setCommandListener(this);//GEN-END:|14-getter|1|14-postInit
            // write post-init user code here
        }//GEN-BEGIN:|14-getter|2|
        return veiculo;
    }
    //</editor-fold>//GEN-END:|14-getter|2|
    //</editor-fold>

    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: veiculoGroup ">//GEN-BEGIN:|24-getter|0|24-preInit
    /**
     * Returns an initiliazed instance of veiculoGroup component.
     * @return the initialized component instance
     */
    public ChoiceGroup getVeiculoGroup() {
        if (veiculoGroup == null) {//GEN-END:|24-getter|0|24-preInit
            // write pre-init user code here
            veiculoGroup = new ChoiceGroup("Tipo de ve\u00EDculo:", Choice.EXCLUSIVE);//GEN-BEGIN:|24-getter|1|24-postInit
            veiculoGroup.append("Picape cabine dupla", null);
            veiculoGroup.append("Utilit\u00E1rio cabine simples", null);
            veiculoGroup.append("\u00D4nibus", null);
            veiculoGroup.append("Micro-\u00F4nibus", null);
            veiculoGroup.append("Trator", null);
            veiculoGroup.append("Motocicleta", null);
            veiculoGroup.append("Caminh\u00E3o", null);
            veiculoGroup.setSelectedFlags(new boolean[] { false, false, false, false, false, false, false });//GEN-END:|24-getter|1|24-postInit
            // write post-init user code here
        }//GEN-BEGIN:|24-getter|2|
        return veiculoGroup;
    }
    //</editor-fold>//GEN-END:|24-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: valorCommand ">//GEN-BEGIN:|33-getter|0|33-preInit
    /**
     * Returns an initiliazed instance of valorCommand component.
     * @return the initialized component instance
     */
    public Command getValorCommand() {
        if (valorCommand == null) {//GEN-END:|33-getter|0|33-preInit
            // write pre-init user code here
            valorCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|33-getter|1|33-postInit
            // write post-init user code here
        }//GEN-BEGIN:|33-getter|2|
        return valorCommand;
    }
    //</editor-fold>//GEN-END:|33-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|35-getter|0|35-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|35-getter|0|35-preInit
            // write pre-init user code here
            backCommand = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|35-getter|1|35-postInit
            // write post-init user code here
        }//GEN-BEGIN:|35-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|35-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: combustivelCommand ">//GEN-BEGIN:|37-getter|0|37-preInit
    /**
     * Returns an initiliazed instance of combustivelCommand component.
     * @return the initialized component instance
     */
    public Command getCombustivelCommand() {
        if (combustivelCommand == null) {//GEN-END:|37-getter|0|37-preInit
            // write pre-init user code here
            combustivelCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|37-getter|1|37-postInit
            // write post-init user code here
        }//GEN-BEGIN:|37-getter|2|
        return combustivelCommand;
    }
    //</editor-fold>//GEN-END:|37-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: combustivel ">//GEN-BEGIN:|32-getter|0|32-preInit
    /**
     * Returns an initiliazed instance of combustivel component.
     * @return the initialized component instance
     */
    public Form getCombustivel() {
        if (combustivel == null) {//GEN-END:|32-getter|0|32-preInit
            // write pre-init user code here
            combustivel = new Form("Calcular IPVA", new Item[] { getCombustivelGroup() });//GEN-BEGIN:|32-getter|1|32-postInit
            combustivel.addCommand(getValorCommand());
            combustivel.addCommand(getBackCommand());
            combustivel.setCommandListener(this);//GEN-END:|32-getter|1|32-postInit
            // write post-init user code here
        }//GEN-BEGIN:|32-getter|2|
        return combustivel;
    }
    //</editor-fold>//GEN-END:|32-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: resultadoCommand ">//GEN-BEGIN:|42-getter|0|42-preInit
    /**
     * Returns an initiliazed instance of resultadoCommand component.
     * @return the initialized component instance
     */
    public Command getResultadoCommand() {
        if (resultadoCommand == null) {//GEN-END:|42-getter|0|42-preInit
            // write pre-init user code here
            resultadoCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|42-getter|1|42-postInit
            // write post-init user code here
        }//GEN-BEGIN:|42-getter|2|
        return resultadoCommand;
    }
    //</editor-fold>//GEN-END:|42-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand1 ">//GEN-BEGIN:|44-getter|0|44-preInit
    /**
     * Returns an initiliazed instance of backCommand1 component.
     * @return the initialized component instance
     */
    public Command getBackCommand1() {
        if (backCommand1 == null) {//GEN-END:|44-getter|0|44-preInit
            // write pre-init user code here
            backCommand1 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|44-getter|1|44-postInit
            // write post-init user code here
        }//GEN-BEGIN:|44-getter|2|
        return backCommand1;
    }
    //</editor-fold>//GEN-END:|44-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand2 ">//GEN-BEGIN:|48-getter|0|48-preInit
    /**
     * Returns an initiliazed instance of backCommand2 component.
     * @return the initialized component instance
     */
    public Command getBackCommand2() {
        if (backCommand2 == null) {//GEN-END:|48-getter|0|48-preInit
            // write pre-init user code here
            backCommand2 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|48-getter|1|48-postInit
            // write post-init user code here
        }//GEN-BEGIN:|48-getter|2|
        return backCommand2;
    }
    //</editor-fold>//GEN-END:|48-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: valor ">//GEN-BEGIN:|41-getter|0|41-preInit
    /**
     * Returns an initiliazed instance of valor component.
     * @return the initialized component instance
     */
    public Form getValor() {
        if (valor == null) {//GEN-END:|41-getter|0|41-preInit
            // write pre-init user code here
            valor = new Form("Calcular IPVA", new Item[] { getValorText() });//GEN-BEGIN:|41-getter|1|41-postInit
            valor.addCommand(getResultadoCommand());
            valor.addCommand(getBackCommand1());
            valor.setCommandListener(this);//GEN-END:|41-getter|1|41-postInit
            // write post-init user code here
        }//GEN-BEGIN:|41-getter|2|
        return valor;
    }
    //</editor-fold>//GEN-END:|41-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: resultado ">//GEN-BEGIN:|47-getter|0|47-preInit
    /**
     * Returns an initiliazed instance of resultado component.
     * @return the initialized component instance
     */
    public Form getResultado() {
        if (resultado == null) {//GEN-END:|47-getter|0|47-preInit
            // write pre-init user code here
            resultado = new Form("Calcular IPVA", new Item[] { getIpvaItem() });//GEN-BEGIN:|47-getter|1|47-postInit
            resultado.addCommand(getBackCommand2());
            resultado.setCommandListener(this);//GEN-END:|47-getter|1|47-postInit
            // write post-init user code here
        }//GEN-BEGIN:|47-getter|2|
        return resultado;
    }
    //</editor-fold>//GEN-END:|47-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: combustivelGroup ">//GEN-BEGIN:|51-getter|0|51-preInit
    /**
     * Returns an initiliazed instance of combustivelGroup component.
     * @return the initialized component instance
     */
    public ChoiceGroup getCombustivelGroup() {
        if (combustivelGroup == null) {//GEN-END:|51-getter|0|51-preInit
            // write pre-init user code here
            combustivelGroup = new ChoiceGroup("Tipo de combustivel:", Choice.EXCLUSIVE);//GEN-BEGIN:|51-getter|1|51-postInit
            combustivelGroup.append("Gasolina", null);
            combustivelGroup.append("Diesel", null);
            combustivelGroup.append("Bicombust\u00EDvel", null);
            combustivelGroup.append("\u00C1lcool", null);
            combustivelGroup.append("G\u00E1s", null);
            combustivelGroup.append("Eletrecidade", null);
            combustivelGroup.setSelectedFlags(new boolean[] { false, false, false, false, false, false });//GEN-END:|51-getter|1|51-postInit
            // write post-init user code here
        }//GEN-BEGIN:|51-getter|2|
        return combustivelGroup;
    }
    //</editor-fold>//GEN-END:|51-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: valorText ">//GEN-BEGIN:|61-getter|0|61-preInit
    /**
     * Returns an initiliazed instance of valorText component.
     * @return the initialized component instance
     */
    public TextField getValorText() {
        if (valorText == null) {//GEN-END:|61-getter|0|61-preInit
            // write pre-init user code here
            valorText = new TextField("Valor venal do ve\u00EDculo:", null, 32, TextField.ANY);//GEN-LINE:|61-getter|1|61-postInit
            // write post-init user code here
        }//GEN-BEGIN:|61-getter|2|
        return valorText;
    }
    //</editor-fold>//GEN-END:|61-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: ipvaItem ">//GEN-BEGIN:|62-getter|0|62-preInit
    /**
     * Returns an initiliazed instance of ipvaItem component.
     * @return the initialized component instance
     */
    public StringItem getIpvaItem() {
        if (ipvaItem == null) {//GEN-END:|62-getter|0|62-preInit
            // write pre-init user code here
            ipvaItem = new StringItem("Valor do IPVA:", null);//GEN-LINE:|62-getter|1|62-postInit
            // write post-init user code here
        }//GEN-BEGIN:|62-getter|2|
        return ipvaItem;
    }
    //</editor-fold>//GEN-END:|62-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">//GEN-BEGIN:|68-getter|0|68-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|68-getter|0|68-preInit
            // write pre-init user code here
            okCommand = new Command("Ok", Command.OK, 0);//GEN-LINE:|68-getter|1|68-postInit
            // write post-init user code here
        }//GEN-BEGIN:|68-getter|2|
        return okCommand;
    }
    //</editor-fold>//GEN-END:|68-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|71-getter|0|71-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|71-getter|0|71-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Sair", Command.EXIT, 0);//GEN-LINE:|71-getter|1|71-postInit
            // write post-init user code here
        }//GEN-BEGIN:|71-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|71-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand3 ">//GEN-BEGIN:|74-getter|0|74-preInit
    /**
     * Returns an initiliazed instance of backCommand3 component.
     * @return the initialized component instance
     */
    public Command getBackCommand3() {
        if (backCommand3 == null) {//GEN-END:|74-getter|0|74-preInit
            // write pre-init user code here
            backCommand3 = new Command("Voltar", Command.BACK, 0);//GEN-LINE:|74-getter|1|74-postInit
            // write post-init user code here
        }//GEN-BEGIN:|74-getter|2|
        return backCommand3;
    }
    //</editor-fold>//GEN-END:|74-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|77-getter|0|77-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|77-getter|0|77-preInit
            // write pre-init user code here
            image1 = Image.createImage(1, 1);//GEN-LINE:|77-getter|1|77-postInit
            // write post-init user code here
        }//GEN-BEGIN:|77-getter|2|77-postInit
        return image1;
    }
    //</editor-fold>//GEN-END:|77-getter|2|77-postInit



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|79-getter|0|79-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|79-getter|0|79-preInit
            // write pre-init user code here
            okCommand1 = new Command("Ok", Command.OK, 0);//GEN-LINE:|79-getter|1|79-postInit
            // write post-init user code here
        }//GEN-BEGIN:|79-getter|2|
        return okCommand1;
    }
    //</editor-fold>//GEN-END:|79-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand2 ">//GEN-BEGIN:|81-getter|0|81-preInit
    /**
     * Returns an initiliazed instance of exitCommand2 component.
     * @return the initialized component instance
     */
    public Command getExitCommand2() {
        if (exitCommand2 == null) {//GEN-END:|81-getter|0|81-preInit
            // write pre-init user code here
            exitCommand2 = new Command("Sair", Command.EXIT, 0);//GEN-LINE:|81-getter|1|81-postInit
            // write post-init user code here
        }//GEN-BEGIN:|81-getter|2|
        return exitCommand2;
    }
    //</editor-fold>//GEN-END:|81-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: form ">//GEN-BEGIN:|78-getter|0|78-preInit
    /**
     * Returns an initiliazed instance of form component.
     * @return the initialized component instance
     */
    public Form getForm() {
        if (form == null) {//GEN-END:|78-getter|0|78-preInit
            // write pre-init user code here
            form = new Form("IPVA CALC", new Item[] { getStringItem() });//GEN-BEGIN:|78-getter|1|78-postInit
            form.addCommand(getOkCommand1());
            form.addCommand(getExitCommand2());
            form.setCommandListener(this);//GEN-END:|78-getter|1|78-postInit
            // write post-init user code here
        }//GEN-BEGIN:|78-getter|2|
        return form;
    }
    //</editor-fold>//GEN-END:|78-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">//GEN-BEGIN:|86-getter|0|86-preInit
    /**
     * Returns an initiliazed instance of stringItem component.
     * @return the initialized component instance
     */
    public StringItem getStringItem() {
        if (stringItem == null) {//GEN-END:|86-getter|0|86-preInit
            // write pre-init user code here
            stringItem = new StringItem("Descri\u00E7\u00E3o do aplicativo:", "O IPVA Calc \u00E9 um aplicativo que disponibiliza ao usu\u00E1rio calcular o valor da aliquota de IPVA do  seu ve\u00EDculo somente informando o tipo de  ve\u00EDculo, combust\u00EDvel utilizado e valor venal.");//GEN-LINE:|86-getter|1|86-postInit
            // write post-init user code here
        }//GEN-BEGIN:|86-getter|2|
        return stringItem;
    }
    //</editor-fold>//GEN-END:|86-getter|2|



    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable(null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet();
        } else {
            initialize();
            startMIDlet();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }
}
